namespace xhtml = "http://www.w3.org/1999/xhtml"
namespace xlink = "http://www.w3.org/1999/xlink"

element library {
  element book {
    attribute id {
      xsd:NMTOKEN { maxLength = "16" }
    },
    attribute available { xsd:boolean },
    element isbn {
      xsd:NMTOKEN { pattern = "[0-9]{9}[0-9x]" }
    },
    element title {
      attribute xml:lang {
        xsd:language { length = "2" }
      },
      xsd:token { maxLength = "255" }
    },
    element author {
      attribute id {
        xsd:NMTOKEN { maxLength = "16" }
      },
      element name {
        xsd:token { maxLength = "255" }
      },
      element born {
        [
          xhtml:p [
            id = "dates-notz"
            "We don't want timezones in our dates (see "
            xhtml:a [ href = "ref.xhtml#dates" "dates ref" ]
            " for additional info."
          ]
        ]
        xsd:date {
          minInclusive = "1900-01-01"
          maxInclusive = "2099-12-31"
          [
            xlink:type = "simple"
            xlink:arcrole = "http://www.rddl.org/purposes#reference"
            xlink:href = "#dates-notz"
          ]
          pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
        }
      },
      element dead {
        xsd:date {
          minInclusive = "1900-01-01"
          maxInclusive = "2099-12-31"
          pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
        }
      }?
    }*,
    element character {
      attribute id {
        xsd:NMTOKEN { maxLength = "16" }
      },
      element name {
        xsd:token { maxLength = "255" }
      },
      element born {
        xsd:date {
          minInclusive = "1900-01-01"
          maxInclusive = "2099-12-31"
          pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
        }
      },
      element qualification {
        xsd:token { maxLength = "255" }
      }
    }*
  }+
}
